<?php

namespace Fluency\Web\Http;

/**
 * A terminating response that redirects the client to a specified target.
 *
 * @package Fluency\Web\Http
 * @author  Ignas Rudaitis
 * @since   1.0
 */
class RedirectingResponse extends TerminatingResponse
{
    const DEFAULT_REASON = "HTTP/1.1 302 Found";

    /**
     * The constructor.
     *
     * @param string $target the URL to redirect to
     * @param string $reason a HTTP status code header explaining the reason for redirection
     */
    public function __construct($target, $reason = self::DEFAULT_REASON)
    {
        parent::__construct("", array("Location: {$target}", $reason));
    }
}
